﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Control2
{
    class Human
    {
        private string lastName;
        private string firstName;
        DateTime dateOfBirth;

        public string LastName
        {
            get { return lastName; }
            set
            {
                if (value == null ||  value.Length == 0) //string.IsNullOrWhiteSpace(value)
                {
                    Console.WriteLine("You haven't entered last name");   //throw new ArgumentException("First Name");
                }
                else
                {
                    lastName = value;
                }
            }
        }

        public string FirstName
        {
            get { return firstName; }
            set
            {
                if (value == null || value.Length == 0)
                {
                    Console.WriteLine("You haven't entered first name");
                }
                else
                {
                    firstName = value;
                }
            }
        }

        public DateTime DateOfBirth
        {
            get { return dateOfBirth; }
            set
            {
                if (value > DateTime.Now)
                {
                    Console.WriteLine("Incorrect date was entered");
                }
                else
                {
                    dateOfBirth = value;
                }
            }
        }

         public Human(string lastName, string firstName, DateTime dateOfBirth)
        {
            LastName = lastName;
            FirstName = firstName;
            DateOfBirth = dateOfBirth;
        }
    }
}
